package java_thinking.unit_19._19_11;

import static java_thinking.unit_19._19_11.OutCome.DRAW;
import static java_thinking.unit_19._19_11.OutCome.LOSE;
import static java_thinking.unit_19._19_11.OutCome.WIN;

/**
 * @Desc:   19.11.4 使用二维数组进行分发
 * @author: cww
 * @DateTime: 2019/5/24 20:18
 */

public enum RoShamBo6 implements Competitor<RoShamBo6> {
    PAPER, SCISSORS, ROCK;
    private static OutCome[][] table = {
            {DRAW, LOSE, WIN},
            {WIN, DRAW, LOSE},
            {LOSE, WIN, DRAW},
    };

    @Override
    public OutCome compete(RoShamBo6 competitor) {
        return table[this.ordinal()][competitor.ordinal()];
    }

    public static void main(String[] args) {
        RoShamBo.play(RoShamBo6.class, 20);
    }
}
